package com.common.utils;

import lombok.extern.slf4j.Slf4j;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @类名 PatternUtil
 * @描述 TODO
 * @版本 1.0
 * @创建人 Lying~
 * @创建时间 2023/1/29 9:39
 * @修改人 Lying~
 * @修改时间 2023/1/29 9:39
 **/
@Slf4j
public class PatternUtil {

    public static boolean isContain(String source, String subItem){
        if (source.contains(subItem) && source.contains(">"+subItem+"<")){
            return false;
        }
        source = source.toLowerCase();
        subItem = subItem.toLowerCase();
        String pattern = "\\b"+subItem+"\\b";
        Pattern p=Pattern.compile(pattern);
        Matcher m=p.matcher(source);
        return m.find();
    }

    public static void main(String[] args) {
        System.out.println(isContain("s Asb "," asb1 ".trim()));
    }
}
